<!DOCTYPE html>
<script src=../../../resources/testharness.js></script>
<script src=../../../resources/testharnessreport.js></script>
<script src=../../assert_selection.js></script>
<script>
selection_test(
    '<div contenteditable dir="rtl">ab^cd|ef</div>',
    selection => selection.modify('move', 'left', 'character'),
    '<div contenteditable dir="rtl">ab|cdef</div>',
    'Move left on forward LTR selection in RTL block');

selection_test(
    '<div contenteditable dir="rtl">ab^cd|ef</div>',
    selection => selection.modify('move', 'right', 'character'),
    '<div contenteditable dir="rtl">abcd|ef</div>',
    'Move right on forward LTR selection in RTL block');

selection_test(
    '<div contenteditable dir="rtl">ab|cd^ef</div>',
    selection => selection.modify('move', 'left', 'character'),
    '<div contenteditable dir="rtl">ab|cdef</div>',
    'Move left on backward LTR selection in RTL block');

selection_test(
    '<div contenteditable dir="rtl">ab|cd^ef</div>',
    selection => selection.modify('move', 'right', 'character'),
    '<div contenteditable dir="rtl">abcd|ef</div>',
    'Move right on backward LTR selection in RTL block');

selection_test(
    '<div contenteditable dir="ltr">\u05D0\u05D1^\u05D2\u05D3|\u05D4\u05D5</div>',
    selection => selection.modify('move', 'left', 'character'),
    '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2\u05D3|\u05D4\u05D5</div>',
    'Move left on forward RTL selection in LTR block');

selection_test(
    '<div contenteditable dir="ltr">\u05D0\u05D1^\u05D2\u05D3|\u05D4\u05D5</div>',
    selection => selection.modify('move', 'right', 'character'),
    '<div contenteditable dir="ltr">\u05D0\u05D1|\u05D2\u05D3\u05D4\u05D5</div>',
    'Move right on forward RTL selection in LTR block');

selection_test(
    '<div contenteditable dir="ltr">\u05D0\u05D1|\u05D2\u05D3^\u05D4\u05D5</div>',
    selection => selection.modify('move', 'left', 'character'),
    '<div contenteditable dir="ltr">\u05D0\u05D1\u05D2\u05D3|\u05D4\u05D5</div>',
    'Move left on backward RTL selection in LTR block');

selection_test(
    '<div contenteditable dir="ltr">\u05D0\u05D1|\u05D2\u05D3^\u05D4\u05D5</div>',
    selection => selection.modify('move', 'right', 'character'),
    '<div contenteditable dir="ltr">\u05D0\u05D1|\u05D2\u05D3\u05D4\u05D5</div>',
    'Move right on backward RTL selection in LTR block');
</script>
